﻿using System;
using Spring.Core;
using Spring.Aop;
using Spring.Context;
using Spring.Context.Support;
using System.Windows.Forms;
namespace pos.entity
{
    /// <summary>
    /// SpringFactory 的摘要说明。
    /// </summary>
    public class SpringContext
    {
        public SpringContext()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }
    
        private static bool isInit = false;
        private static IApplicationContext context;
        public static void init()
        {
           
                string[] xmlFiles = new string[2];
                //  xmlFiles[0] = "assembly://SpringNHibernateSample/OKEC.Sample/Spring_bean.xml";
                xmlFiles[0] = "assembly://pos/pos/hiberate.xml";
                xmlFiles[1] = "assembly://pos/pos/dao.xml";
                context = new XmlApplicationContext(xmlFiles);
                isInit = true;
          
           
        }
        public static IApplicationContext Context
        {
            get
            {
                if (!isInit)
                {
                    init();
                }
                return context;
            }
        }
    }
}
